<?php
//################################################################
// Userpanel
//################################################################

    // include stylesheets
    $this->echoStylesheets();

    // boxed action
    if($this->isBoxed == 1) {
        require('boxed.inc.php');
    }
    // logout
    elseif($this->siteParameter == 'logout') {
        require('logout.inc.php');
    }
    else {

        // login script
        if(isset($_POST['login'])) {
            include('checklogin.inc.php');
        }

        // if user logged in
        if(isset($_SESSION['userID'])) {

            if(isset($_GET['success'])) {
                // output success
                $template_vars = array(
                    'message' => $this->getText('successful_login')
                );
                echo $indexModul->getTemplate('successful_content',$template_vars);

                if(isset($_SESSION['oldUrl'])) {
                    echo '<meta http-equiv="refresh" content="3;url='.$_SESSION['oldUrl'].'">';
                    unset($_SESSION['oldUrl']);
                }

            }
            else {
                // output userpanel
                $template_vars = array();
                echo $this->getTemplate('logged',$template_vars);
            }

        }
        else {
            // output login form
            $template_vars = array();
            echo $this->getTemplate('login',$template_vars);
        }
    }
?>